<?php
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller {
      // tp内置构造函数
	function _initialize(){
         // 先查询顶级数据
		$top_nav = D('nav')->where('pid=0')->select();
		 // 先查询子级数据
		$child_nav = D('nav')->where('pid!=0')->select();
		$this->assign('top_nav',$top_nav);
		$this->assign('child_nav',$child_nav);
 // echo CONTROLLER_NAME;die;
		// 动态实例化类对象
		// echo 
 if(CONTROLLER_NAME!=Index){
		$this->Model=D(CONTROLLER_NAME);
 }

	}
    
}